package com.butte.mound.admin.controller;

import com.butte.mound.frame.record.LogRecord;
import com.butte.mound.frame.record.LogTypeEnum;
import com.butte.mound.frame.security.Auth;
import com.butte.mound.shared.model.TbUser;
import com.butte.mound.shared.service.TbUserService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class AdminWeb {

  private final TbUserService tbUserService;

  @Transactional(rollbackFor = Exception.class)
  @ApiOperation("测试接口")
  @Auth(authCode = {"admin"})
  @LogRecord(logType= LogTypeEnum.LOGIN)
  @GetMapping("/test")
  public TbUser test(){
    return tbUserService.getById(1);
  }

}
